package LEETCODE;

import java.util.ArrayList;
import java.util.List;

public class Test {

}

class Solution {
    public int removeDuplicates(int[] nums) {

        List test=new ArrayList();

        Integer flag =null;
        for (int num:nums){
            if (flag == null){
                flag=num;
                test.add(num);
            }else if(flag == num){
                
            }else {
                flag=num;
                test.add(num);
            }

        }
        return test.toArray().length;
    }
}